package org.mybatis.generator.my.plugins;

import org.mybatis.generator.api.IntrospectedColumn;
import org.mybatis.generator.api.IntrospectedTable;
import org.mybatis.generator.api.PluginAdapter;
import org.mybatis.generator.api.dom.java.Field;
import org.mybatis.generator.api.dom.java.Interface;
import org.mybatis.generator.api.dom.java.TopLevelClass;

import javax.annotation.processing.Generated;
import java.util.List;

public class RemoveAtGeneratedPlugin extends PluginAdapter {


    @Override
    public boolean clientGenerated(Interface interfaze, IntrospectedTable introspectedTable) {
        interfaze.getAnnotations().remove(Generated.class.getName());
        return true;
    }

    @Override
    public boolean modelFieldGenerated(Field field, TopLevelClass topLevelClass, IntrospectedColumn introspectedColumn, IntrospectedTable introspectedTable, ModelClassType modelClassType) {
        topLevelClass.getAnnotations().remove(Generated.class.getName());
        return true;
    }

//    @Override
//    public boolean sqlMapGenerated(GeneratedXmlFile sqlMap, IntrospectedTable introspectedTable) {
//        return true;
//    }

    @Override
    public boolean validate(List<String> warnings) {
        return true;
    }
}
